import { CustomRequest } from "@/utils/request"

export const queryBanners = (params: {
  pageNum: number,
  pageSize: number
  schoolId?: number
}) => {
  const { pageNum, pageSize, schoolId } = params
  return CustomRequest.get('/api/banner/banner/list', {
    pageNum,
    pageSize,
    schoolId: schoolId ? schoolId : -1
  })
}

export const queryVideos = (params: {
  pageNum: number,
  pageSize: number,
  schoolId?: number
}) => {
  const { pageNum, pageSize, schoolId } = params
  return CustomRequest.get('/api/banner/bannerVideo/list', {
    pageNum,
    pageSize,
    schoolId: schoolId ? schoolId : -1
  })
}

export const queryWorks = (params: {
  pageNum: number,
  pageSize: number,
  schoolId?: number
}) => {
  const { pageNum, pageSize, schoolId } = params
  return CustomRequest.get('/api/works/works/list', {
    pageNum,
    pageSize,
    schoolId: schoolId ? schoolId : -1,
    /**
     * 作品类型，0=普通作品，1=优秀作品	
     */
    type: 1
  })
}

export const querySchools = (params: {
  pageNum: number,
  pageSize: number,
  schoolId?: number
}) => {
  const { pageNum, pageSize, schoolId } = params
  return CustomRequest.get('/api/school/school/list', {
    pageNum,
    pageSize,
    schoolId: schoolId ? schoolId : -1
  })
}

export const queryWorksType = (params: {
  pageNum: number,
  pageSize: number,
}) => {
  return CustomRequest.get('/api/works/worksType/list', {
    ...params
  })
}


export const queryUserInfo = () => {
  return CustomRequest.get('/api/user/user/info')
}